package com.cmxh.shipper.service.impl;

import com.cmxh.shipper.mapper.FreightsourcesMapper;
import com.cmxh.shipper.pojo.Freightsources;
import com.cmxh.shipper.service.FreightsourcesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FreightsourcesServiceimpl implements FreightsourcesService {
    @Autowired
    private FreightsourcesMapper freightsourcesMapper;

    // 查询货源根据货源状态
    @Override
    public List<Freightsources> selectHuoYuanBYStatus(Freightsources freightsources) {
        List<Freightsources> selectHuoYuanBYStatus = freightsourcesMapper.selectHuoYuanBYStatus(freightsources);
        return selectHuoYuanBYStatus;
    }

    // 查询全部货源(根据货主id)
    @Override
    public List<Freightsources> selectHuoYuan(Integer dirverid) {
        List<Freightsources> selectHuoYuan = freightsourcesMapper.selectHuoYuan(dirverid);
        return selectHuoYuan;
    }

    //源发布成功货查询
    @Override
    public Freightsources selectHuoYuanw(Integer sourceid) {
        return freightsourcesMapper.selectHuoYuanw(sourceid);
    }

    //  添加货源
    @Override
    public int insert(Freightsources record) {
        int insert = freightsourcesMapper.insert(record);
        return insert;
    }



    //定时修改货源状态
    @Override
    public void updateStatus() {
        freightsourcesMapper.updateStatus();
    }

    @Override
    public void updateStatus2() {
         freightsourcesMapper.updateStatus2();
    }
    //定时根据货源余量修改状态
    @Override
    public void updateStatus3() {
        freightsourcesMapper.updateStatus3();
    }

    @Override
    public int updates(Integer sourceid) {
        return freightsourcesMapper.updates(sourceid);
    }


}
